home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************/
- /* */
- /* Program to Produce Conversion Table for PCDir */
- /* */
- /***************************************************************************/
- /* */
- /* */
- /* You should not alter the PCDir Config file unless you are confident */
- /* you understand what you are doing. PCDir makes no checks on the */
- /* consistency or validity of the config file, it assumes that the */
- /* config file is correct. In particular the number of items in the */
- /* header must be correct. PC File Extensions should only contain */
- /* valid characters. */
- /* */
- /* PCDir uses the config file as follows */
- /* */
- /* When converting files ADFS to PC the PC file extension is found by */
- /* searching the table for the first matching ADFS filetype. The PC */
- /* file extension is the corresponding entry in the table. If */
- /* un-matched the file type is taken as DAT ( For Data ). */
- /* */
- /* Similarly for files being converted PC to ADFS the first entry with */
- /* a matching extension. Will cause the filetype to be set to the */
- /* relevant entry. */
- /* */
- /* In either case, CR/LF processing is carried out according to the */
- /* process flag. */
- /* */
- /* Fields maker NYU are Not Yet Used */
- /* */
- /* If you regularly move program source between PC diskettes and ADFS */
- /* then you may well wish to change the filetypes for the associated */
- /* source type. e.g. change the filetype for C to a user filetype. */
- /* Then moving the file back to a PC Diskette will preserve the */
- /* file extension of C. ( rather than TXT as is the default ). */
- /* */
- /***************************************************************************/
-
- #include <stdio.h>
- #include <string.h>
-
- typedef struct {
- char pcdrive; /* PC Drive ( Will be overrided by PC$Drive ) */
- char prompt; /* Non-Zero causes insert disk prompts */
- char step[3]; /* Default steps for floppies ( 1 or 2 ) NYU */
- int items; /* Number of conversion table entries */
- } hdr;
-
- typedef struct { /* Table record Structure */
- int type; /* ADFS file type */
- char ext[3]; /* PC File extension */
- char flag; /* Bit 0 CRLF Processing */
- } rec;
- /*--- Global Variables ---*/
- FILE *fp;
-
- /**************************************************************************/
- /* */
- /* Add Table Entry */
- /* */
- /* parameters :- */
- /* ADFS File type */
- /* IBM File Extension */
- /* Process */
- /* 0 Straight copy */
- /* 1 CRLF Processing */
- /* */
- /**************************************************************************/
- void add_entry(int t,char *s,int f)
- {
- rec record;
-
- record.type = t; /* Copy filetype to record */
- strcpy(record.ext,s); /* Copy Extension to record */
- record.flag = f; /* Copy conversion flag to record */
- fwrite(&record,sizeof(record),1,fp); /* write out record */
- }
-
- /**************************************************************************/
- /* */
- /* Main function : create config file */
- /* */
- /**************************************************************************/
- int main(void)
-
- {
- char *filename = ":4.Probation.!PCDir.Config"; /* Target file name */
- hdr header; /* File header */
-
- fp = fopen(filename,"w"); /* Open file */
- /**************************************************************************/
- /* */
- /* Setup Header */
- /* */
- /**************************************************************************/
- header.pcdrive = 0; /* Default PC Drive ( PC$Drive overides */
- header.prompt = 0; /* Prompt for Disk Insert 0 or 1 */
- header.step[0] = 1; /* Default Step for drive 0 */
- header.step[1] = 1; /* Default Step for drive 1 */
- header.step[2] = 1; /* Default Step for drive 2 */
- header.items = 19; /* Number of table entries : max 25 */
-
- fwrite(&header,12,1,fp); /* Write out header */
-
- /**************************************************************************/
- /* */
- /* Table entries */
- /* */
- /**************************************************************************/
- add_entry(0xFFF,"TXT",1); /* Text 1 */
- add_entry(0xDDC,"ARC",0); /* Arc Archives 2 */
- add_entry(0xFF5,"PS ",0); /* Post Script 3 */
- add_entry(0xDEA,"DXF",1); /* DXF Files 4 */
- add_entry(0xFFB,"BAS",0); /* Basic 5 */
- add_entry(0xFF8,"FF8",0); /* Applications 6 */
- add_entry(0xFFF,"C ",1); /* C Source 7 */
- add_entry(0xFFF,"H ",1); /* H Headers 8 */
- add_entry(0xFFF,"SCR",1); /* Script 9 */
- add_entry(0xFFF,"DOC",1); /* Documentation 10 */
- add_entry(0xFFF,"ME ",1); /* ReadMe files 11 */
- add_entry(0xFFF,"PAS",1); /* Pascal Source 12 */
- add_entry(0x405,"GMF",0); /* Graphics Metafile for !DrwCgm 13 */
- add_entry(0x405,"CGM",0); /* Graphics Metafile for !DrwCgm 14 */
- add_entry(0x695,"GIF",0); /* Graphics Interchange File 15 */
- add_entry(0xAFF,"AFF",0); /* Draw File 16 */
- add_entry(0xFF0,"TFF",0); /* Tiff File 17 */
- add_entry(0xDB0,"WK1",0); /* Lotus 1-2-3 file 18 */
- add_entry(0xDB0,"WKS",0); /* Lotus 1-2-3 file 19 */
- /**************************************************************************/
- /* Non Standard Table Entries */
- /**************************************************************************/
-
- fclose(fp); /* Close File */
- return(0);
- }
-